package gameEngine.agents.observationSystem.analyzer;

import gameEngine.agents.observationSystem.analyzer.EnumOfAnalyzer.Analyzer_Type;
import gameEngine.agents.teamMateModel.TeamMateModel;
import org.apache.log4j.Logger;

/**
 * @author vladimir && alon
 *	Factory of analyzer - create and return Analyzers
 */
public class AnalayzerFactory {
static Logger log = Logger.getLogger(gameEngine.agents.Logger.Massages.MassageFactory.class);
	/**
	 * create instance of Analyzer by Type {@link Analyzer_Type}
	 * @param type {@link Analyzer_Type}
	 * @param teamMateModel reference to {@link TeamMateModel} as it should change it every turn 
	 * @return {@link ObservationAnalyzer}
	 */
	public static ObservationAnalyzer create(Analyzer_Type type,TeamMateModel teamMateModel){
		switch(type){
		case AVERAGE_ANALYZER:
			log.debug("AvarageAnalyzer created");
			return new AverageAnalyzer(teamMateModel);
		
		case MAX_ANALYZER:
			log.debug("MaxAnalyzer created");
			return new MaxAnalyzer(teamMateModel);
		
		case MIN_ANALYZER:
			log.debug("MinAnalyzer created");
			return new MinAnalyzer(teamMateModel);
		}
		log.debug("no Analyzer match for type "+type+"return AverageAnalyzer");
		return new AverageAnalyzer(teamMateModel);
	}
}
